package com.phkj.qdh.ui.adapter

import android.content.Context
import android.view.ViewGroup
import android.widget.ImageView
import com.bumptech.glide.Glide
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.QuickViewHolder
import com.phkj.qdh.R
import com.phkj.qdh.bean.LawOrTeamInspectBean

/**
 * 巡查类型选择
 */
class LawInspectTypeSelectAdapter : BaseQuickAdapter<LawOrTeamInspectBean, QuickViewHolder>() {
    override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: LawOrTeamInspectBean?) {
        val iv = holder.getView<ImageView>(R.id.iv_bg)
        when(position%7){
            0->{
              Glide.with(context)
                  .load(R.mipmap.img_bg1)
                  .into(iv)
            }
            1->{
                Glide.with(context)
                    .load(R.mipmap.img_bg2)
                    .into(iv)
            }
            2->{
                Glide.with(context)
                    .load(R.mipmap.img_bg3)
                    .into(iv)
            }
            3->{
                Glide.with(context)
                    .load(R.mipmap.img_bg4)
                    .into(iv)
            }
            4->{
                Glide.with(context)
                    .load(R.mipmap.img_bg5)
                    .into(iv)
            }
            5->{
                Glide.with(context)
                    .load(R.mipmap.img_bg6)
                    .into(iv)
            }
            6->{
                Glide.with(context)
                    .load(R.mipmap.img_bg7)
                    .into(iv)
            }
        }
        holder.setText(R.id.tv_title,item?.name)
        val ivTitle = holder.getView<ImageView>(R.id.iv_title)
        when (item?.name) {
            "接出警管理" -> {ivTitle.setImageResource(R.mipmap.icon_chujin)}
            "执法取证视音频管理" -> {ivTitle.setImageResource(R.mipmap.icon_quzheng)}
            "案卷集中保管" -> {ivTitle.setImageResource(R.mipmap.icon_anjuanbaoguan)}
            "办案区硬件管理" -> {ivTitle.setImageResource(R.mipmap.icon_yingjian)}
            "办案区使用" -> {ivTitle.setImageResource(R.mipmap.icon_bananqu)}
            "财务管理" -> {ivTitle.setImageResource(R.mipmap.icon_caiwu)}
            "案卷质量" -> {ivTitle.setImageResource(R.mipmap.icon_anjuan)}
            else -> {ivTitle.setImageResource(R.mipmap.icon_qita)}
        }

    }

    override fun onCreateViewHolder(
        context: Context, parent: ViewGroup, viewType: Int
    ): QuickViewHolder {
        return QuickViewHolder(R.layout.item_inspect_type_select, parent)
    }

}